﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure
{
    public class ConfigSettings
    {
        /// <summary>
        /// 生产者的端口
        /// </summary>
        public static int BrokerProducerPort { get; set; }
        /// <summary>
        /// 消费者的端口
        /// </summary>
        public static int BrokerConsumerPort { get; set; }
        /// <summary>
        /// 管理后台端口
        /// </summary>
        public static int BrokerAdminPort { get; set; }


        public static string EQueueConnectionString { get; set; }
        public static string ENodeConnectionString { get; set; }
        public static string ConnectionString { get; set; }
        
        public static void Initialize()
        {
            if (ConfigurationManager.ConnectionStrings["equeue"] != null)
            {
                EQueueConnectionString = ConfigurationManager.ConnectionStrings["equeue"].ConnectionString;
            }
            if (ConfigurationManager.ConnectionStrings["enode"] != null)
            {
                ENodeConnectionString = ConfigurationManager.ConnectionStrings["enode"].ConnectionString;
            }
            if (ConfigurationManager.ConnectionStrings["default"] != null)
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
            }

            BrokerProducerPort = 10000;
            BrokerConsumerPort = 10001;
            BrokerAdminPort = 10002;
        }

    }
}
